import { get, post, postJson } from "@@/utils/http.util"
import urlFunc from "@@/utils/url.func"
import {
  baseRes, PageData, loginReqType, verifyCodeReqType, registerReqType, isRegisterReqType,
  pwdSecretReqType, pwdSecretResType, retrievePwdReqType, productListResType, productType,
  recommendProductResType, userInfoResType, updateUserInfoReqType, industryByExhibitionResType
} from "@@/interfaces/api.interface"

export default {
  //用户是否注册
  isRegister(params: isRegisterReqType) {
    return get<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/isRegister`,
      params
    })
  },
  //注册
  register(params: registerReqType) {
    return postJson<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/register`,
      params
    })
  },
  //登录
  login(params: loginReqType) {
    return postJson<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/login`,
      params
    })
  },
  //发送验证码
  sendVerificationCode(params: verifyCodeReqType) {
    return get<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/sendVerificationCode`,
      params
    })
  },
  //密码找回获取密钥
  getSecretKey(params: pwdSecretReqType) {
    return postJson<baseRes<pwdSecretResType>>({
      url: `${urlFunc.requestHost()}/api/account/getSecretKey`,
      params
    })
  },
  //密码找回
  retrievePassword(params: retrievePwdReqType) {
    return postJson<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/retrievePassword`,
      params
    })
  },

  //产品列表
  findProductList(params: { industryId: number }) {
    return get<baseRes<Array<productListResType<productType>>>>({
      url: `${urlFunc.requestHost()}/api/solution/find`,
      params
    })
  },

  //产品详情
  findProductDetail(params: { id: number }) {
    return get<baseRes<productListResType<productType>>>({
      url: `${urlFunc.requestHost()}/api/solution/findById`,
      params
    })
  },
  //推荐产品详情
  recommendProduct(params: { id: number }) {
    return get<baseRes<recommendProductResType>>({
      url: `${urlFunc.requestHost()}/api/product/findById`,
      params
    })
  },
  //获取用户信息
  getUserInfo() {
    return get<baseRes<userInfoResType>>({
      url: `${urlFunc.requestHost()}/api/account/getUserInfo`,
    })
  },
  //修改用户信息
  updateUserInfo(params: updateUserInfoReqType) {
    return postJson<baseRes>({
      url: `${urlFunc.requestHost()}/api/account/update`,
      params
    })
  },
  //获取默认展会id
  getExhibitionId() {
    return get<baseRes<number>>({
      url: `${urlFunc.requestHost()}/api/exhibition/default`
    })
  },
  //查询展会行业
  listIndustryByExhibitionId(params: { exhibitionId: number }) {
    return get<baseRes<industryByExhibitionResType[]>>({
      url: `${urlFunc.requestHost()}/api/exhibition/industry/listIndustryByExhibitionId`,
      params
    })
  },

}





